<template>
  <div>
    <van-goods-action>
      <van-goods-action-icon
        :icon="ifSave ? 'star' : 'star-o'"
        :text="ifSave ? '已收藏' : '收藏'"
        :color="ifSave ? '#ff5000' : ''"
        @click="ifSave = !ifSave"
      />
      <van-goods-action-icon icon="cart-o" text="购物车" :badge="goodsCount" />
      <van-goods-action-button
        type="warning"
        text="加入购物车"
        @click="toAddCart"
      />
      <van-goods-action-button type="danger" text="立即购买" />
    </van-goods-action>
  </div>
</template>
 
<script>
export default {
  name: "",
  props: ["goodsCount"],
  data() {
    return {
      ifSave: false,
    };
  },
  methods: {
    toAddCart() {
      this.$emit("addToCart");
    },
  },
};
</script>
 
<style scoped lang="less">
.van-goods-action {
  z-index: 9999;
}
</style>